package com.zz.ecommerce.positiveList;

import com.zz.ecommerce.common.GridRequest;
import com.zz.ecommerce.common.GridResult;
import com.zz.ecommerce.common.constants.TableConstants;
import com.zz.ecommerce.pojo.TPositiveList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by admin on 2016/4/8.
 */
@Controller
@RequestMapping("/positiveList")
@Scope("prototype")
public class PositiveListController {

    @Autowired
    private TPositiveListDao tPositiveListDao;

    /**
     * 正面清单首页
     *
     * @return
     */
    @RequestMapping(value = "init", method = {RequestMethod.GET})
    public String init() {
        return "positiveList/index";
    }

    /**
     * 运正面清单列表
     *
     * @param tPositiveList
     * @param request
     * @return
     */
    @RequestMapping("/queryTPositiveList")
    @ResponseBody
    public GridResult queryTPositiveList(TPositiveList tPositiveList, GridRequest request) {
        return new GridResult(tPositiveListDao.page(TableConstants.T_POSITIVE_LIST, tPositiveList, request.getStart(), request.getEnd(), request.getSortOrder()), request, tPositiveListDao.count(TableConstants.T_POSITIVE_LIST, tPositiveList));
    }
}
